<style>
    .userMsg .label_top {
        width: 100%;
        height: 40px;
        line-height: 33px;
        /* margin-bottom: 30px; */
        padding: 10px 0 5px;
        border-bottom: 1px solid #ccc;
        position: relative;
    }
    
    .userMsg .label_top p {
        height: 33px;
        line-height: 30px;
        font-size: 15px;
        display: inline-block;
        margin-left: 10px;
    }
    
    .userMsg .act {
        height: 30px;
        line-height: 30px;
        color: #44CEF6 !important;
        padding: 0px !important;
        border-bottom: 2px solid #44CEF6;
    }
    
    .avatar {
        width: 150px;
        height: 150px;
        background-color: rgb(207, 207, 204);
    }
    
    .userFirstRow {
        display: flex;
        flex-direction: row;
        height: auto !important;
        /* border-bottom: 1px solid rgb(207, 207, 204); */
    }
    
    .firstRowMsg1 {
        flex-direction: column;
        margin-left: 20px;
        line-height: 16px;
        height: 16px;
    }
    
    .firstRowMsg p {
        margin-bottom: 0px !important;
    }
    
    .moreMsg {
        margin-top: 10px;
        font-weight: 600;
    }
    
    .moreMsgShow {
        margin-left: 20px;
        font-weight: 300;
    }
</style>
<template>
    <div class="userMsg w944">
        <alert ref="alert"></alert>
        <div class="label_top">
            <button @click="cancel">返回</button>
            <p class="act">用户详情</p>
            <p @click="soTeacher">学习档案</p>
            <p @click="toCreditRecord">学分记录</p>
        </div>
        <div class="userFirstRow">
            <img :src="userMsg.headimg" class="avatar">
            <div class="firstRowMsg1">
                <p style="font-size: 17px;">{{userMsg.nickname}}</p><br>
                <p> 账号状态：{{userMsg.status}}</p><br>
                <p style="color:#44CEF6;"> 当前学分：{{userMsg.credit}}</p><br>
                <p> 注册时间：{{userMsg.createTime}}</p><br>
                <p> 最后登录：{{userMsg.logintime}}</p><br>
            </div>
        </div>
        <div class="">
            <p class="moreMsg">更多信息</p><br>
            <div class="moreMsgShow">
                <p> 姓名：{{userMsg.nickname}}</p><br>
                <p> 性别：{{userMsg.sex}}</p><br>
                <p> 工号：{{userMsg.jobNum}}</p><br>
                <p> 出生日期：{{userMsg.birthday}}</p><br>
                <p> 学历：{{userMsg.educationName}}</p><br>
                <p> 工作省份：{{userMsg.proviceName}}</p><br>
                <p> 组织/部门：{{userMsg.organizationName}}</p><br>
                <p> 岗位：{{userMsg.stationName}}</p><br>
                <p> 兴趣：{{userMsg.userLabelName}}</p><br>
                <p> 邮箱：{{userMsg.email}}</p><br>
                <p> 地址：{{userMsg.address}}</p><br>
            </div>

        </div>
    </div>

</template>
<script>
    import labelAll from '../../components/label.vue';
    import alert from '../../components/Alert.vue';
    export default {
        data() {
            return {
                paramsId: localStorage.getItem('userid'),
                userMsg: '',
            }
        },
        methods: {
            getParams() {
                var paramsId = localStorage.getItem('userid');
                // localStorage.setItem('paramsId', this.$route.params.id)
                if (paramsId) {
                    this.$ajax({
                        url: this.$root.jifuUrl + "/getUserInfoById?userid=" + paramsId + '&rootcompanyid=1',
                        method: 'GET',
                        data: {},
                        success: res => {
                            if (res.data.code == 200) {
                                this.userMsg = res.data.data;
                            }
                        }
                    });
                }
            },
            toCreditRecord() {
                localStorage.setItem('nickname', this.userMsg.nickname)
                console.log('paramsId.id', this.paramsId)
                this.$router.push({
                    name: 'creditRecord',
                    params: {
                        id: this.paramsId,
                        nickname: this.userMsg.nickname,
                        credit: this.userMsg.credit,
                    }
                })
            },
            soTeacher() {
                console.log('paramsId.id', this.paramsId)
                this.$router.push({
                    name: 'soTeacher',
                    params: {
                        userid: this.paramsId,
                        nickname: this.userMsg.nickname,
                    }
                })
            },
            cancel() {
                localStorage.removeItem('userid')
                this.$router.push({
                        name: 'userManager',
                    })
                    // this.$router.go(-1);
            },

        },
        components: {
            labelAll,
            alert
        },
        mounted() {
            this.getParams();
        }
    }
</script>